﻿using BibleBase;
using MarkupParser;
using NVI_LIB;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TEST
{
    class Program
    {
        static void Main(string[] args)
        {
#if _
            IndiceDeTemasParser parser = 
                new IndiceDeTemasParser(
                    @"C:\NVI\IndicedeTemasSample.docx",
                    @"C:\NVI\BIN\MapeoVocabularioTemas.bin",
                    @"C:\NVI\BIN\ModifEntradas.bin");
            parser.Parse();
            parser.Close();
#endif
            //IndiceDeTemasParser.LoadBiblias();
#if _
            string nviFile = @"C:\Users\sam\Desktop\NVI.txt";
            if (File.Exists(nviFile))
                File.Delete(nviFile);
            File.AppendAllText(nviFile, BibleLoader.LoadBible().ToString());
#endif
            //File.WriteAllText(@"C:\Users\sam\Desktop\1.txt", NVIBible.LoadFromBibleGateway("Genesis", 1));
#if _
            DOM.Parse(File.ReadAllText(@"C:\Users\sam\Desktop\1.txt"));
#endif
#if NVI
            Bible nvi = BibleLoader.LoadBible("NVI", @"C:\Users\sam\Desktop\NVI.bin");
            NVIBible.SortBible(nvi);

            string nviFile = @"C:\Users\sam\Desktop\NVI.txt";
            if (File.Exists(nviFile))
                File.Delete(nviFile);
            File.AppendAllText(nviFile, nvi.ToString());
#endif
#if RV
            Bible rv = BibleLoader.LoadBible("RVR1960", @"C:\Users\sam\Desktop\RVR1960.bin");
            BibleLoader.SortBible(rv);

            string rvFile = @"C:\Users\sam\Desktop\RVR1960.txt";
            if (File.Exists(rvFile))
                File.Delete(rvFile);
            File.AppendAllText(rvFile, rv.ToString());
#endif
            Bible nvi = BibleLoader.LoadBible("NVI", @"C:\Users\sam\Desktop\NVI.bin");
            BibleLoader.SortBible(nvi);
            Bible rv = BibleLoader.LoadBible("RVR1960", @"C:\Users\sam\Desktop\RVR1960.bin");
            BibleLoader.SortBible(rv);

            Bible.CompareBibles(nvi, rv);

            nvi.Save(@"C:\Users\sam\Desktop\NVI.bin");
            rv.Save(@"C:\Users\sam\Desktop\RVR1960.bin");

            Abreviaturas abreviaturas = BibleLoader.LoadAbreviaturas(@"C:\NVI\abreviaturas.xlsx");

            IndiceDeTemasParser parser =
                new IndiceDeTemasParser(
                    @"C:\NVI\IndicedeTemasSample.docx",
                    @"C:\NVI\BIN\MapeoVocabularioTemas.bin",
                    @"C:\NVI\BIN\ModifEntradas.bin", nvi, rv, abreviaturas);
            //parser.ParseEntries();
            //parser.ReplaceEntries();

            //parser.ParseVerses();
            //parser.CountVerses();
            parser.ParseExactVerses();
            parser.HighlightVerses();
            //parser.ReplaceVerses();

            parser.Close();

            Console.WriteLine("Press enter to exit...");
            Console.ReadLine();
        }
    }
}
